package com.yxy.mapper;

import com.github.pagehelper.Page;
import com.yxy.common.PageResult;
import com.yxy.domain.dto.IncentiveDTO;
import com.yxy.domain.dto.IncentivePageQueryDTO;
import com.yxy.domain.po.Incentive;
import com.yxy.domain.vo.IncentivePageQueryVO;
import com.yxy.domain.vo.IncentiveVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface IncentiveMapper {
    /**
     * 根据句子查询激励
     * @param sentence
     * @return
     */
    @Select("select * from incentive where sentence = #{sentence}")
    Incentive getIncentiveBySentence(String sentence);

    /**
     * 插入激励
     * @param incentive
     */
    void insert(Incentive incentive);

    /**
     * 分页查询激励语句
     * @param incentivePageQueryDTO
     * @return
     */
    @Select("select * from incentive")
    Page<IncentivePageQueryVO> page(IncentivePageQueryDTO incentivePageQueryDTO);

    /**
     * 查询所有激励语句
     * @return
     */
    @Select("select sentence from incentive where status = 1")
    List<IncentiveVO> selectAll();

    /**
     * 修改激励语句状态
     * @param id
     * @param status
     */
    @Update("update incentive set status = #{status} where id = #{id}")
    void updateState(int id, int status);

    /**
     * 批量删除激励语句
     * @param ids
     */
    void deleteByIds(List<Integer> ids);
}
